import request from "@/utils/request"

export enum OccupyStatus {
  启用 = 1,
  禁用 = 2,
  未设置 = 3,
}
export interface QueryOccupyListParams extends PaginationParams {
  /** 场站 id */
  stubGroupId?: string
  /** 场站名称 */
  stationName?: string
  /** 场站状态 */
  status?: OccupyStatus
}

export interface Occupy {
  /** 开始日期 */
  beginDay: number
  /** 结束时间 */
  endDay: number
  /** 创建日期 */
  createTime: number
  /** 电价 */
  feeInfo: string
  /** 免费分钟数 */
  freeTime: number
  id: number
  /** 最大收费金额 */
  maxMoney: string
  /** 电站 ID */
  stationId: string
  /** 电站名称 */
  stationName: string
  status: OccupyStatus
  updateTime: number
}

export async function queryChargeList(params: QueryOccupyListParams) {
  return request<Occupy[]>('/app/manager/station/occupy/list', {
    data: params,
  })
}

export async function setRule(params: Partial<Occupy>) {
  return request('/app/manager/station/occupy/set', {
    data: params,
  })
}

export async function updateStatus(params: {
  stubGroupId: string
  status: OccupyStatus
}) {
  return request('/app/manager/station/occupy/status', {
    data: params,
  })
}
